#pragma once

#include <iostream>
#include <vector>
using namespace std;

enum State
{
	EXIT,
	EMPTY,
	DELETE
};

template <class K, class V>
struct HashData
{
	pair<K, V> _kv;
	State _state = EMPTY;
};

template <class K, class V>
class HashTable
{
public:
	HashTable()
	{
		_tables.resize(10);
	}

	bool insert(const pair<K, V>& kv)
	{
		if (_n * 10 / _tables.size() >= 7)
		{
			vector<K, V> newtables(2 * _tables.size());

			for (auto& data : _tables)
			{
				if (data._state == EXISST)
				{
					index = hashi + i;
					i++;

					index %= _tables.size();
				}

				_tables[index]._kv = kv;
				_tables[index]._state = EXIT;
				++_n;
				return true;
			}

			newtables.swap(_tables);
		}

	}

	/*HashData<K, V>* find(const K& key)
	{
		size_t hashi = key % _tables.size();
		int i = 1;
		int index = hashi;

		while (_tables[index]._state != EMPTY)
		{
			if (_tables[index]._state == EXIT && _tables[index]._kv.first == key)
			{
				return &_tables[index];
			}

			index = hashi + i;
			i++;

			if (index == hashi)
			{
				return false;
			}
		}

		return false;
	}

	bool erase(const K& key)
	{
		HashData<K, V>* ret = find(key);

		if (ret != nullptr)
		{
			return false;
		}
		else
		{
			ret->state = DELETE;
			return true;
		}

	}*/
private:
	vector<HashData<K, V>> _tables;
	size_t _n = 0;
};
